home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14531 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: >> File Compare Algorithm <<
  5. Date: 15 Apr 1996 09:22:30 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4ktt46INNpl@keats.ugrad.cs.ubc.ca>
  8. References: <4ksocc$pv3@uuneo.neosoft.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4ksocc$pv3@uuneo.neosoft.com>,  <bmathai@neosoft.com> wrote:
  12. >I'm new to C programming and need some help.  
  13. >
  14. >Does anyone know of a source where I may obtain a file compare
  15. >algorithm for text files?  Not a binary compare algorithm, but a line
  16.  
  17. Algorithms exist in textbooks and papers.
  18.  
  19. >by line comparison.  One that can "calibrate" itself after coming
  20.  
  21. If you want code, there is GNU diff.
  22.  
  23. >across mismatches in 2 files.  If you could PLEASE email me your
  24. >response as I don't know if I can frequent this newsgroup often.
  25. >Thanks in advance!
  26.  
  27. Example diff run:
  28.  
  29. File1
  30.  
  31. foo
  32. bar
  33.  
  34. File2
  35.  
  36. foo
  37. inserted
  38. stuff
  39. bak
  40.  
  41.  
  42. diff output:
  43.  
  44. 2c2,4
  45. < bar
  46. ---
  47. > inserted
  48. > stuff
  49. > bak
  50.  
  51. That means that line two was changed from "bar" to "inserted/stuff/bak"
  52.  
  53. The diff program is used by UNIX programmers to transmit patches to source code
  54. in a condensed format, because the diff output can be interpreted as a set of
  55. editing commands to apply to an original to produce the new version.
  56. -- 
  57. I'm not really a jerk, but I play one on Usenet.
  58.